# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=ikona
pkgver=1.0
pkgrel=1
pkgdesc="An icon preview utility designed for KDE Plasma"
url="https://invent.kde.org/kde/ikona/"
# mips, ppc64le and s390x blocked by qt5-qtwebengine-dev
# armhf blocked by qt5-qtdeclarative-dev
arch="all !ppc64le !s390x !armhf !mips !mips64"
license="GPL-2.0-or-later"
makedepends="extra-cmake-modules cargo qt5-qtbase-dev qt5-qtwebengine-dev
	qt5-qtdeclarative-dev ki18n-dev kirigami2-dev kconfigwidgets-dev
	plasma-framework-dev"
source="https://download.kde.org/stable/ikona/$pkgver/ikona-$pkgver.tar.xz"
subpackages="
	$pkgname-lang
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch
	"
options="!check" # No tests

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install

	mkdir -p "$pkgdir"/usr/share/bash-completion
	mv "$pkgdir"/etc/bash_completion.d "$pkgdir"/usr/share/bash-completion/completions
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	amove usr/share/zsh/site-functions
}

fishcomp() {
	depends=""
	pkgdesc="Fish completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	amove usr/share/fish/completions
}

sha512sums="30bde3f3b062ccf661ee8950c762412a6b9eebff625216641607cbae7f7f8123702c231cbce82acfb666a8b69c863e4b22e8daf79d1541b7c70781189ffee144  ikona-1.0.tar.xz"
